package design_pattern

import "fmt"

type House interface {
	Live()
}

type DxmHouse struct{}

func (d *DxmHouse) Live() {
	fmt.Println("dxmer are working")
}

type Decorator struct {
	h House
}

func (d *Decorator) SetHose(house House) {
	d.h = house
}

type KitchenDecorator struct {
	Decorator
}

func (k *KitchenDecorator) Live() {
	fmt.Println("---------厨房包装开始--------")
	k.h.Live()
	fmt.Println("---------厨房包装结束--------")
}

type BedroomDecorator struct {
	Decorator
}

func (b *BedroomDecorator) Live() {
	fmt.Println("---------卧室包装开始---------")
	b.h.Live()
	fmt.Println("---------卧室包装结束---------")
}

func main011() {
	dxm := &DxmHouse{}

	k := &KitchenDecorator{}
	k.SetHose(dxm)

	b := &BedroomDecorator{}
	b.SetHose(k)

	b.Live()
}
